package cosc617_blackteam;

/**
 * @author sherbahadur

 * OrderCollections contain all order items of a restaurant
 * To get individual order list, one should use getOrderOfIndividualCustomerIterator
 * to traverse through the orderlists
 */
import java.util.ArrayList;
import java.util.Collection;
import java.util.Iterator;

public class OrderCollections implements Iterable<Order> {
	private Order orderItem;
	ArrayList<Order> orderList;

	public OrderCollections() {
		orderList = new ArrayList<Order>();
	}

	public void addOrderItem(Order order) {
		orderItem = order;
		orderList.add(orderItem);
	}

	/**
	 * returns list of of total orders
	 */
	public ArrayList<Order> list() {
		return orderList;
	}

	/**
	 * 
	 * @param c
	 *            is the customer information input to get his particular orders
	 * @return list of orders of a given person
	 */
	public Iterator<Order> getOrderOfIndividualCustomerIterator(Customer c) {
		return new OrderOfIndividualCustomerIterator(orderList, c);
	}


	@Override
	public Iterator<Order> iterator() {

		return new DefaultOrderIterator(orderList);
	}

	/**
	 * @return Iterator of all unmade orders by FIFO
	 */
	public Iterator<Order> unmadeIterator() {
		return new UnmadeOrderIterator(orderList);
	}

	
	/**
	 * @return Iterator of all unmade orders sorted by prep time
	 */
	public Iterator<Order> sortedUnmadeIterator() {

		return new SortedUnmadeOrderIterator(orderList);
	}

	/**
	 * @return Iterator of all unmade orders sorted by party size
	 */
	public Iterator<Order> unmadeByPartySizeIterator() {
		return new UnmadeByPartySizeIterator(orderList);
	}

	public void removeOrders(Collection<Order> orders) {
		orderList.removeAll(orders);
	}
}
